<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('步道用户')" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="role-form">
					<div class="select-list">
						<ul>
							<li>
								用户名：<input type="text" name="username"/>
							</li>
							<li>
								所属步道（做个下拉框根据步道id查询）：<input type="text" name="trail_id"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
	        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
	var editFlag = true;
	var removeFlag = true;
		var prefix = ctx + "trail/user";

		$(function() {
		    var options = {
		        url: prefix + "/list",
		        createUrl: prefix + "/edit",
		        updateUrl: prefix + "/edit_{id}",
		        sortName: "trailinfo",
		        modalName: "步道用户列表",
		        columns: [
	        	{
		            field: 'userface',
		            title: '用户头像（这里显示图片）'
		        },
		        {
		            field: 'id',
		            title: '用户编号'
		        },
		        {
		            field: 'username',
		            title: '名称',
		            sortable: true
		        },
		        {
		            field: 'phone',
		            title: '电话',
		        },
		        {
		            field: 'gender',
		            title: '性别',
		        },
		        {
		            field: 'height',
		            title: '身高',
		        },
		        {
		            field: 'weight',
		            title: '体重',
		        },
		        {
		            field: 'age',
		            title: '年龄',
		        },
		        
		        {
		            field: 'add_time',
		            title: '创建时间',
		            sortable: true
		        },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                var actions = [];
		                if(row.id>1){
		                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
		                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
		                }
		                return actions.join('');
		            }
		        }]
		    };
		    $.table.init(options);
		});

	</script>
</body>
</html>